package com.ljx.recruitment.interview.enums;

import com.ljx.recruitment.common.exception.ApiException;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum DashboardDeliverTrendTimeEnum {

    YEAR("year", 365),
    MONTH("month", 30),
    WEEK("week", 7);

    private String key;
    private Integer value;

    public static Integer getValueByKey(String key) {
        for (DashboardDeliverTrendTimeEnum item : DashboardDeliverTrendTimeEnum.values()) {
            if (key.equals(item.key)) {
                return item.value;
            }
        }
        throw new ApiException("无效时间参数");
    }


}
